from flask_restx import api


class ExtApix(api.Api):
    """基于flask_restx 0.5.1的拓展版本, 支持绑定父级蓝图控制"""

    def _register_view(self, app, resource, *urls, **kwargs):
        current_blueprint = self.app
        kwargs.update({"parent_blueprint_uuid": current_blueprint.uuid})
        super()._register_view(app, resource, *urls, **kwargs)

    # 屏蔽文档
    def _register_apidoc(self, app):
        conf = app.extensions.setdefault("restx", {})
        conf["apidoc_registered"] = True

    # 屏蔽文档
    def _register_specs(self, app_or_blueprint):
        pass

    # 屏蔽文档
    def _register_doc(self, app_or_blueprint):
        pass
